package util

import (
	"bufio"
    "strings"
)

// 去除空格
func Strip(s string) (r string) {
	if s != " " {
		s = strings.Trim(s, " ")
		s = strings.Trim(s, "\t")
		s = strings.Trim(s, "\n")
		r = strings.Trim(s, "\r")
	}
	return
}

// 提取多行字符串
func SplitLines(s string) []string {
    var lines []string
    sc := bufio.NewScanner(strings.NewReader(s))
    for sc.Scan() {
        lines = append(lines, sc.Text())
    }
    return lines
}